﻿namespace EyeOpen.Web.Mvc
{
	using System;
	using System.Linq.Expressions;
	using System.Web.Mvc;

	public static class WebViewPageExtensions
	{
		public static MvcHtmlString ActionPath<TController>(
			this WebViewPage webViewPage, 
			Expression<Action<TController>> action)
			where TController : Controller
		{
			var controllerName = typeof(TController).Name.Replace("Controller", null);

			var actionName = TypeExtensions.GetMethodName(action);

			return
				new MvcHtmlString(string.Format("{0}/{1}", controllerName, actionName));
		}
	}
}